//
//  AppState.swift
//  JiaoZiTaxi
//
//  Created by Hu Gang on 2022/9/10.
//

import Foundation
import CombineSchedulers

struct AppState : Equatable {
    static func == (lhs: AppState, rhs: AppState) -> Bool {
        return lhs.orderState == rhs.orderState && lhs.carAnnotations.count == rhs.carAnnotations.count && lhs.passengerNum == rhs.passengerNum
    }
    
    var orderState : OrderState = OrderState.none
    var driver : WebSocketJiedanDriverResult?
    var carAnnotations : [MapAnnotationModel] = []
    var passengerNum : Int = 1
}

enum AppAction : Equatable {
    case callTaxi
    case waitingTaxi
//    case runningTaxi
//    case pausingTaxi
//    case stopTaxi
//    case payedTaxi
//    case cancelTaxt
    
    case increment
    case decrement
}

enum OrderState : Equatable {
    case none
    case calling
    case waiting
    case running
    case pausing
    case stop
    case payed
    case cancel
}

enum EnumCurrentState : Equatable {
  case none // 未叫车
  case calling // 正在叫车
  case waiting // 司机已接单
  case running // 开始（已接上乘客)
  case pausing
  case stop
  case paying
  case payed
  case canceling
}

struct ApiError : Error,Equatable {
    
}



struct AppEnvironment {
   // var mainQueue : AnySchedulerOf<DispatchQueue>
}
